package com.demo3;

import java.util.ArrayList;

public class StudentTest {
    public static void main(String[] args) {
        //1.创建一个集合用来存储学生对象
        ArrayList<Student> list = new ArrayList<>();
        //2.创建3个学生对象
        Student student1 = new Student("张三", 23, "男");
        Student student2 = new Student("李四", 24, "女");
        Student student3 = new Student("王五", 25, "男");
        //3.把学生对象添加到集合中
        list.add(student1);
        list.add(student2);
        list.add(student3);
        //4.调用工具类中的方法
        int maxAge = StudentUtil.getMaxAge(list);
        System.out.println("maxAge="+maxAge);
    }
}
